//
//  GTResouceDetailBeizhuTableViewCell.m
//  ShangHaiHuDongApp
//
//  Created by 刘应平 on 2017/7/13.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "GTResouceDetailBeizhuTableViewCell.h"

@interface GTResouceDetailBeizhuTableViewCell ()
/** 简介  */
@property (strong, nonatomic) UILabel  *jianjie;
/**  content  */
@property (strong, nonatomic) UILabel  *content;

@end
@implementation GTResouceDetailBeizhuTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self addSubview:self.jianjie];
        self.jianjie.sd_layout
        .topSpaceToView(self, 15 * [UIScreen zj_screenHScale])
        .leftSpaceToView(self, 20 * [UIScreen zj_screenWScale])
        .heightIs(15 * [UIScreen zj_screenHScale])
        .widthIs(100);
        
        [self addSubview:self.content];
        UIView *under = [UIView new];
        under.backgroundColor = [UIColor themeGrayColor];
        [self addSubview:under];
        under.sd_layout.leftEqualToView(self).bottomEqualToView(self).widthIs([UIScreen zj_screenWith]).heightIs(1);
    }
    return self;
}


- (void)setModel:(ShareResouceDetailModel *)model{
    _model = model;
    self.jianjie.text = [NSString stringWithFormat:@"%@: ",model.title];
    CGFloat height = [model.cellHEIGHT floatValue];
    self.content.attributedText = [UILabel setSpaceForLineWithText:model.content lineSpace:5 * [UIScreen zj_screenHScale]];
    self.content.sd_layout
    .topSpaceToView(self.jianjie, 10 * [UIScreen zj_screenHScale])
    .leftSpaceToView(self, 22 * [UIScreen zj_screenWScale])
    .rightSpaceToView(self, 20 * [UIScreen zj_screenWScale])
    .heightIs(height - 50 * [UIScreen zj_screenHScale]);

}

- (UILabel *)jianjie{
    if (!_jianjie) {
        _jianjie = ({
            UILabel *label = [UILabel new];
            label.textAlignment = NSTextAlignmentLeft;
            label.textColor = [UIColor textBlackColor];
            label.backgroundColor = [UIColor clearColor];
            label.font = LYPFONT(17);
            label;
        });
    }
    return _jianjie;
}

- (UILabel *)content{
    if (!_content) {
        _content = ({
            UILabel *label = [UILabel new];
            label.textAlignment = NSTextAlignmentLeft;
            label.numberOfLines = 0;
            label.textColor = [UIColor textGrayColor];
            label.backgroundColor = [UIColor clearColor];
            label.font = LYPFONT(15);
            label;
        });
    }
    return _content;
}
@end
